home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume17 / cproto / patch01 < prev    next >
Encoding:
Internet Message Format  |  1991-04-04  |  19.8 KB

  1. From: cthuang@contact.UUCP (Chin Huang)
  2. Newsgroups: comp.sources.misc
  3. Subject: v17i078:  cproto - Generate C function prototypes from C source, Patch01
  4. Message-ID: <1991Apr4.033155.3773@sparky.IMD.Sterling.COM>
  5. Date: 4 Apr 91 03:31:55 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: 636a7c8a ec778d63 f867dc14 e1db1ef0
  8.  
  9. Submitted-by: Chin Huang <cthuang@contact.UUCP>
  10. Posting-number: Volume 17, Issue 78
  11. Archive-name: cproto/patch01
  12. Patch-To: cproto: Volume 17, Issue 70-71
  13.  
  14. Here is patch 1 for cproto, a C function prototype generator.
  15. It fixes a couple of bugs, cleans up some code, and includes
  16. a formatted manual page.
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of shell archive."
  25. # Contents:  patch1 cproto.man
  26. # Wrapped by ibmpc@laphroig.UUCP on Sat Mar 30 13:31:00 1991
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f patch1 -a "${1}" != "-c" ; then 
  29.   echo shar: Will not over-write existing file \"patch1\"
  30. else
  31. echo shar: Extracting \"patch1\" \(13164 characters\)
  32. sed "s/^X//" >patch1 <<'END_OF_patch1'
  33. Xdiff -c old/CHANGES ./CHANGES
  34. X*** old/CHANGES    Thu Mar 28 15:41:44 1991
  35. X--- ./CHANGES    Sat Mar 30 13:18:50 1991
  36. X***************
  37. X*** 1,5 ****
  38. X--- 1,14 ----
  39. X  Version 2
  40. X  
  41. X+ Patchlevel 1
  42. X+ 
  43. X+ - Fix: Cproto incorrectly generated the parameter "int ..." in
  44. X+   prototypes of functions taking variable parameters.
  45. X+ - Fix: Function definitions can now be followed by an optional
  46. X+   semicolon.  I found this feature in every C compiler I tried.
  47. X+ 
  48. X+ Patchlevel 0
  49. X+ 
  50. X  - Added formal parameter promotion.
  51. X  - Added prototype style that surrounds prototypes with a guard macro.
  52. X  - Handles C++ style comment //.
  53. Xdiff -c old/cproto.1 ./cproto.1
  54. X*** old/cproto.1    Thu Mar 28 15:41:44 1991
  55. X--- ./cproto.1    Sat Mar 30 13:18:54 1991
  56. X***************
  57. X*** 1,4 ****
  58. X! .\" $Id: cproto.1 2.1 91/03/25 10:13:30 cthuang Exp $
  59. X  .\"
  60. X  .de EX          \"Begin example
  61. X  .ne 5
  62. X--- 1,4 ----
  63. X! .\" $Id: cproto.1 2.2 91/03/30 13:18:50 cthuang Exp $
  64. X  .\"
  65. X  .de EX          \"Begin example
  66. X  .ne 5
  67. X***************
  68. X*** 140,149 ****
  69. X  .TP
  70. X  .B \-V
  71. X  Print version information.
  72. X- .SH AUTHOR
  73. X- Chin Huang
  74. X- cthuang@contact.uucp
  75. X- chin.huang@canrem.uucp
  76. X  .SH BUGS
  77. X  When cproto finds an error, it usually outputs the not very descriptive
  78. X  message "syntax error".
  79. X--- 140,145 ----
  80. X***************
  81. X*** 154,159 ****
  82. X--- 150,161 ----
  83. X  \\n    newline
  84. X  \\t    tab
  85. X  .EE
  86. X+ .SH AUTHOR
  87. X+ .nf
  88. X+ Chin Huang
  89. X+ cthuang@contact.uucp
  90. X+ chin.huang@canrem.uucp
  91. X+ .fi
  92. X  .SH "SEE ALSO"
  93. X  cc(1),
  94. X  cpp(1)
  95. Xdiff -c old/cproto.c ./cproto.c
  96. X*** old/cproto.c    Thu Mar 28 15:41:58 1991
  97. X--- ./cproto.c    Sat Mar 30 13:19:00 1991
  98. X***************
  99. X*** 1,10 ****
  100. X! /* $Id: cproto.c 2.1 91/03/25 11:40:34 cthuang Exp $
  101. X   *
  102. X   * C prototype generator
  103. X   * Reads C source code and outputs ANSI C function prototypes.
  104. X   */
  105. X  #ifndef lint
  106. X! static char *rcsid = "$Id: cproto.c 2.1 91/03/25 11:40:34 cthuang Exp $";
  107. X  #endif
  108. X  #include <stdio.h>
  109. X  #include <ctype.h>
  110. X--- 1,10 ----
  111. X! /* $Id: cproto.c 2.2 91/03/30 13:18:55 cthuang Exp $
  112. X   *
  113. X   * C prototype generator
  114. X   * Reads C source code and outputs ANSI C function prototypes.
  115. X   */
  116. X  #ifndef lint
  117. X! static char *rcsid = "$Id: cproto.c 2.2 91/03/30 13:18:55 cthuang Exp $";
  118. X  #endif
  119. X  #include <stdio.h>
  120. X  #include <ctype.h>
  121. X***************
  122. X*** 149,156 ****
  123. X  static void
  124. X  usage ()
  125. X  {
  126. X!     fprintf(stderr,
  127. X!     "usage: %s [ option ... ] [ file ... ]\n", progname);
  128. X      fputs("  -e      output \"extern\" keyword before global declarations\n",
  129. X      stderr);
  130. X      fputs("  -f n    select function prototype style (0 to 4)\n", stderr);
  131. X--- 149,155 ----
  132. X  static void
  133. X  usage ()
  134. X  {
  135. X!     fprintf(stderr, "usage: %s [ option ... ] [ file ... ]\n", progname);
  136. X      fputs("  -e      output \"extern\" keyword before global declarations\n",
  137. X      stderr);
  138. X      fputs("  -f n    select function prototype style (0 to 4)\n", stderr);
  139. X***************
  140. X*** 163,175 ****
  141. X      fputs("  -U name\n", stderr);
  142. X      fputs("  -I directory\n", stderr);
  143. X      fputs("          C preprocessor options\n", stderr);
  144. X!     fputs(
  145. X!     "  -F fmt  set prototype template in the form \"int main (a, b)\"\n",
  146. X      stderr);
  147. X      fputs("  -V      print version information\n", stderr);
  148. X      exit(1);
  149. X  }
  150. X  
  151. X  main (argc, argv)
  152. X  int argc;
  153. X  char **argv;
  154. X--- 162,174 ----
  155. X      fputs("  -U name\n", stderr);
  156. X      fputs("  -I directory\n", stderr);
  157. X      fputs("          C preprocessor options\n", stderr);
  158. X!     fputs("  -F fmt  set prototype template in the form \"int main (a, b)\"\n",
  159. X      stderr);
  160. X      fputs("  -V      print version information\n", stderr);
  161. X      exit(1);
  162. X  }
  163. X  
  164. X+ int
  165. X  main (argc, argv)
  166. X  int argc;
  167. X  char **argv;
  168. X***************
  169. X*** 288,294 ****
  170. X      }
  171. X  
  172. X      if (optind == argc) {
  173. X!     printf("/* stdin */\n");
  174. X      parse_file();
  175. X      } else {
  176. X      for (i = optind; i < argc; ++i) {
  177. X--- 287,293 ----
  178. X      }
  179. X  
  180. X      if (optind == argc) {
  181. X!     strcpy(cur_file, "stdin");
  182. X      parse_file();
  183. X      } else {
  184. X      for (i = optind; i < argc; ++i) {
  185. X***************
  186. X*** 305,312 ****
  187. X          }
  188. X  #endif
  189. X          strcpy(cur_file, argv[i]);
  190. X-         line_num = 1;
  191. X-         printf("/* %s */\n", cur_file);
  192. X          parse_file();
  193. X  #ifdef MSDOS
  194. X          fclose(yyin);
  195. X--- 304,309 ----
  196. Xdiff -c old/grammar.y ./grammar.y
  197. X*** old/grammar.y    Thu Mar 28 15:41:56 1991
  198. X--- ./grammar.y    Sat Mar 30 13:19:04 1991
  199. X***************
  200. X*** 1,4 ****
  201. X! /* $Id: grammar.y 2.1 91/02/28 11:16:07 cthuang Exp $
  202. X   *
  203. X   * yacc grammar for C prototype generator
  204. X   * This was derived from the grammar given in Appendix A of
  205. X--- 1,4 ----
  206. X! /* $Id: grammar.y 2.2 91/03/30 13:19:00 cthuang Exp $
  207. X   *
  208. X   * yacc grammar for C prototype generator
  209. X   * This was derived from the grammar given in Appendix A of
  210. X***************
  211. X*** 88,93 ****
  212. X--- 88,94 ----
  213. X  external_declaration
  214. X      : declaration
  215. X      | function_definition
  216. X+     | function_definition ';'
  217. X      | T_EXTERN T_QUOTEC T_BRACES
  218. X      | error
  219. X      ;
  220. X***************
  221. X*** 564,569 ****
  222. X--- 565,572 ----
  223. X  void
  224. X  parse_file ()
  225. X  {
  226. X+     printf("/* %s */\n", cur_file);
  227. X+     line_num = 1;
  228. X      typedef_names = create_symbol_table();
  229. X      yyparse();
  230. X  }
  231. Xdiff -c old/Makefile ./Makefile
  232. X*** old/Makefile    Thu Mar 28 15:41:44 1991
  233. X--- ./Makefile    Sat Mar 30 13:19:08 1991
  234. X***************
  235. X*** 1,4 ****
  236. X! # $Id: makefile 2.1 91/03/25 10:56:54 cthuang Exp $
  237. X  #
  238. X  # MSDOS makefile for C prototype generator
  239. X  
  240. X--- 1,4 ----
  241. X! # $Id: Makefile 2.2 91/03/30 13:19:06 cthuang Exp $
  242. X  #
  243. X  # MSDOS makefile for C prototype generator
  244. X  
  245. X***************
  246. X*** 9,24 ****
  247. X  
  248. X  DEFINES = -DMSDOS
  249. X  
  250. X! DIST1 =        README CHANGES Makefile Makefile.uni cproto.1
  251. X! DIST2 =        $(SOURCES)
  252. X  SOURCES =    lex.l grammar.y \
  253. X          config.h cproto.h patchlev.h semantic.h symbol.h \
  254. X          cproto.c semantic.c string.c symbol.c
  255. X  CSOURCES =    cproto.c semantic.c string.c symbol.c y_tab.c
  256. X! OBJECTS =    cproto.obj semantic.obj getopt.obj symbol.obj \
  257. X!         y_tab.obj
  258. X  
  259. X! all: cproto.exe
  260. X  
  261. X  cproto.exe: $(OBJECTS)
  262. X      $(CC) $(CFLAGS) $(OBJECTS)
  263. X--- 9,25 ----
  264. X  
  265. X  DEFINES = -DMSDOS
  266. X  
  267. X! DIST1 =        README CHANGES
  268. X! DIST2 =        cproto.man
  269. X! DIST3 =        cproto.1 Makefile Makefile.uni
  270. X! DIST4 =        $(SOURCES)
  271. X  SOURCES =    lex.l grammar.y \
  272. X          config.h cproto.h patchlev.h semantic.h symbol.h \
  273. X          cproto.c semantic.c string.c symbol.c
  274. X  CSOURCES =    cproto.c semantic.c string.c symbol.c y_tab.c
  275. X! OBJECTS =    cproto.obj semantic.obj getopt.obj symbol.obj y_tab.obj
  276. X  
  277. X! all: cproto.exe cproto.man
  278. X  
  279. X  cproto.exe: $(OBJECTS)
  280. X      $(CC) $(CFLAGS) $(OBJECTS)
  281. X***************
  282. X*** 32,37 ****
  283. X--- 33,41 ----
  284. X  lex_yy.c: lex.l
  285. X      $(LEX) lex.l
  286. X  
  287. X+ cproto.man: cproto.1
  288. X+     cawf -man $*.1 >$@
  289. X+ 
  290. X  TAGS: $(SOURCES)
  291. X      etags -t $(SOURCES)
  292. X  
  293. X***************
  294. X*** 41,47 ****
  295. X      erase *.log
  296. X      erase lex_yy.c
  297. X      erase y_tab.c
  298. X!     erase cproto1.exe
  299. X      
  300. X  lint:
  301. X      lint -B $(DEFINES) $(CSOURCES)
  302. X--- 45,51 ----
  303. X      erase *.log
  304. X      erase lex_yy.c
  305. X      erase y_tab.c
  306. X!     erase cproto.exe
  307. X      
  308. X  lint:
  309. X      lint -B $(DEFINES) $(CSOURCES)
  310. X***************
  311. X*** 50,68 ****
  312. X      cpr $(SOURCES) | lpr -J'cproto'
  313. X  
  314. X  shar:
  315. X!     rmcr $(DIST1)
  316. X!     rmcr $(DIST2)
  317. X!     shar $(DIST1) >cproto.sh1
  318. X!     rmcr cproto.sh1
  319. X!     shar $(DIST2) >cproto.sh2
  320. X!     rmcr cproto.sh2
  321. X  
  322. X  zip:
  323. X      pkzip -u cproto README CHANGES Makefile.* *.1 *.c *.h grammar.y lex.l
  324. X  
  325. X  ci:
  326. X!     ci -r2 -u $(DIST1)
  327. X!     ci -r2 -u $(DIST2)
  328. X  
  329. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  330. X  
  331. X--- 54,71 ----
  332. X      cpr $(SOURCES) | lpr -J'cproto'
  333. X  
  334. X  shar:
  335. X!     rmcr $(DIST1) $(DIST2) $(DIST3)
  336. X!     rmcr $(DIST4)
  337. X!     shar $(DIST1) $(DIST2) $(DIST3) >cproto.sh1
  338. X!     shar $(DIST4) >cproto.sh2
  339. X!     rmcr cproto.sh1 cproto.sh2
  340. X  
  341. X  zip:
  342. X      pkzip -u cproto README CHANGES Makefile.* *.1 *.c *.h grammar.y lex.l
  343. X  
  344. X  ci:
  345. X!     ci -u2 $(DIST1) $(DIST3)
  346. X!     ci -u2 $(DIST4)
  347. X  
  348. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  349. X  
  350. Xdiff -c old/Makefile.uni ./Makefile.uni
  351. X*** old/Makefile.uni    Thu Mar 28 15:41:44 1991
  352. X--- ./Makefile.uni    Sat Mar 30 13:19:10 1991
  353. X***************
  354. X*** 1,4 ****
  355. X! # $Id: Makefile.uni 2.1 91/02/28 11:15:54 cthuang Exp $
  356. X  #
  357. X  # UNIX makefile for C prototype generator
  358. X  
  359. X--- 1,4 ----
  360. X! # $Id: Makefile.uni 2.2 91/03/30 13:19:09 cthuang Exp $
  361. X  #
  362. X  # UNIX makefile for C prototype generator
  363. X  
  364. X***************
  365. X*** 9,16 ****
  366. X  # Define SYSV for System V, otherwise BSD is assumed.
  367. X  #DEFINES = -DSYSV
  368. X  
  369. X! DIST1 =        README CHANGES Makefile Makefile.dos cproto.1
  370. X! DIST2 =        $(SOURCES)
  371. X  SOURCES =    lex.l grammar.y \
  372. X          config.h cproto.h patchlev.h semantic.h symbol.h \
  373. X          cproto.c semantic.c string.c symbol.c
  374. X--- 9,18 ----
  375. X  # Define SYSV for System V, otherwise BSD is assumed.
  376. X  #DEFINES = -DSYSV
  377. X  
  378. X! DIST1 =        README CHANGES
  379. X! DIST2 =        cproto.man
  380. X! DIST3 =        cproto.1 Makefile Makefile.dos
  381. X! DIST4 =        $(SOURCES)
  382. X  SOURCES =    lex.l grammar.y \
  383. X          config.h cproto.h patchlev.h semantic.h symbol.h \
  384. X          cproto.c semantic.c string.c symbol.c
  385. X***************
  386. X*** 17,23 ****
  387. X  CSOURCES =    cproto.c semantic.c string.c symbol.c y.tab.c
  388. X  OBJECTS =    cproto.o semantic.o string.o symbol.o y.tab.o
  389. X  
  390. X! all: cproto
  391. X  
  392. X  cproto: $(OBJECTS)
  393. X      $(CC) $(CFLAGS) -o $@ $(OBJECTS)
  394. X--- 19,25 ----
  395. X  CSOURCES =    cproto.c semantic.c string.c symbol.c y.tab.c
  396. X  OBJECTS =    cproto.o semantic.o string.o symbol.o y.tab.o
  397. X  
  398. X! all: cproto cproto.man
  399. X  
  400. X  cproto: $(OBJECTS)
  401. X      $(CC) $(CFLAGS) -o $@ $(OBJECTS)
  402. X***************
  403. X*** 28,38 ****
  404. X  lex.yy.c: lex.l
  405. X      $(LEX) lex.l
  406. X  
  407. X  TAGS: $(SOURCES)
  408. X      etags -t $(SOURCES)
  409. X  
  410. X  clean:
  411. X!     rm *.o *.bak *.log cproto1.exe
  412. X      
  413. X  lint:
  414. X      lint -B $(DEFINES) $(CSOURCES)
  415. X--- 30,43 ----
  416. X  lex.yy.c: lex.l
  417. X      $(LEX) lex.l
  418. X  
  419. X+ cproto.man: cproto.1
  420. X+     nroff -man $*.1 >$@
  421. X+ 
  422. X  TAGS: $(SOURCES)
  423. X      etags -t $(SOURCES)
  424. X  
  425. X  clean:
  426. X!     rm *.o *.bak *.log cproto
  427. X      
  428. X  lint:
  429. X      lint -B $(DEFINES) $(CSOURCES)
  430. X***************
  431. X*** 41,51 ****
  432. X      cpr $(SOURCES) | lpr -J'cproto'
  433. X  
  434. X  shar:
  435. X!     shar $(DIST1) >cproto.sh1
  436. X!     shar $(DIST2) >cproto.sh2
  437. X  
  438. X  ci:
  439. X!     ci -u $(DIST1) $(DIST2)
  440. X  
  441. X  depend:
  442. X      makedepend $(CSOURCES)
  443. X--- 46,56 ----
  444. X      cpr $(SOURCES) | lpr -J'cproto'
  445. X  
  446. X  shar:
  447. X!     shar $(DIST1) $(DIST2) $(DIST3) >cproto.sh1
  448. X!     shar $(DIST4) >cproto.sh2
  449. X  
  450. X  ci:
  451. X!     ci -u2 $(DIST1) $(DIST3) $(DIST4)
  452. X  
  453. X  depend:
  454. X      makedepend $(CSOURCES)
  455. Xdiff -c old/patchlev.h ./patchlev.h
  456. X*** old/patchlev.h    Thu Mar 28 15:41:58 1991
  457. X--- ./patchlev.h    Sat Mar 30 13:19:38 1991
  458. X***************
  459. X*** 1,1 ****
  460. X! #define PATCHLEVEL 0
  461. X--- 1,1 ----
  462. X! #define PATCHLEVEL 1
  463. Xdiff -c old/semantic.c ./semantic.c
  464. X*** old/semantic.c    Thu Mar 28 15:42:00 1991
  465. X--- ./semantic.c    Sat Mar 30 13:19:44 1991
  466. X***************
  467. X*** 1,4 ****
  468. X! /* $Id: semantic.c 2.1 91/03/25 11:40:31 cthuang Exp $
  469. X   *
  470. X   * C prototype generator
  471. X   * These routines implement the semantic actions executed by the yacc parser.
  472. X--- 1,4 ----
  473. X! /* $Id: semantic.c 2.2 91/03/30 13:19:39 cthuang Exp $
  474. X   *
  475. X   * C prototype generator
  476. X   * These routines implement the semantic actions executed by the yacc parser.
  477. X***************
  478. X*** 303,309 ****
  479. X--- 303,311 ----
  480. X          output_error();
  481. X          fprintf(stderr, "declared argument \"%s\" is missing\n", d->name);
  482. X      } else {
  483. X+         free(p->declarator.text);
  484. X          p->declarator.text = strdup(d->text);
  485. X+ 
  486. X          decl_spec_text = decl_spec->text;
  487. X          if (promote_param && strcmp(d->text, d->name) == 0) {
  488. X              s = rindex(decl_spec_text, ' ');
  489. X***************
  490. X*** 313,318 ****
  491. X--- 315,321 ----
  492. X          else if (strcmp(s, "float") == 0)
  493. X              decl_spec_text = "double";
  494. X          }
  495. X+         free(p->decl_spec.text);
  496. X          p->decl_spec.text = strdup(decl_spec_text);
  497. X      }
  498. X      }
  499. X***************
  500. X*** 378,384 ****
  501. X      *s = *(p->declarator.name);
  502. X      } else {
  503. X      if (strlen(p->declarator.text) > 0) {
  504. X!         putchar(' ');
  505. X          output_declarator(&(p->declarator));
  506. X      }
  507. X      }
  508. X--- 381,388 ----
  509. X      *s = *(p->declarator.name);
  510. X      } else {
  511. X      if (strlen(p->declarator.text) > 0) {
  512. X!         if (strcmp(p->declarator.text, "...") != 0)
  513. X!         putchar(' ');
  514. X          output_declarator(&(p->declarator));
  515. X      }
  516. X      }
  517. X***************
  518. X*** 464,470 ****
  519. X       * part.  The default type in this cause is "int".
  520. X       */
  521. X      for (p = declarator->params.first; p != NULL; p = p->next) {
  522. X!     if (strlen(p->decl_spec.text) == 0) {
  523. X          free(p->decl_spec.text);
  524. X          p->decl_spec.text = strdup("int");
  525. X      }
  526. X--- 468,475 ----
  527. X       * part.  The default type in this cause is "int".
  528. X       */
  529. X      for (p = declarator->params.first; p != NULL; p = p->next) {
  530. X!     if (strlen(p->decl_spec.text) == 0 &&
  531. X!         strcmp(p->declarator.text, "...") != 0) {
  532. X          free(p->decl_spec.text);
  533. X          p->decl_spec.text = strdup("int");
  534. X      }
  535. Xdiff -c old/semantic.h ./semantic.h
  536. X*** old/semantic.h    Thu Mar 28 15:41:58 1991
  537. X--- ./semantic.h    Sat Mar 30 13:19:46 1991
  538. X***************
  539. X*** 1,6 ****
  540. X! /* $Id: semantic.h 2.1 91/02/28 11:16:19 cthuang Exp $
  541. X   *
  542. X!  * Declarations for semantics action routines
  543. X   */
  544. X  
  545. X  extern boolean is_typedef_name(/*
  546. X--- 1,6 ----
  547. X! /* $Id: semantic.h 2.2 91/03/30 13:19:44 cthuang Exp $
  548. X   *
  549. X!  * Declarations for semantic action routines
  550. X   */
  551. X  
  552. X  extern boolean is_typedef_name(/*
  553. X***************
  554. X*** 9,15 ****
  555. X  extern void new_decl_spec(/*
  556. X      DeclSpec *decl_spec,
  557. X      char *text,
  558. X!     unsigned short flags
  559. X      */);
  560. X  extern void join_decl_specs(/*
  561. X      DeclSpec *result,
  562. X--- 9,15 ----
  563. X  extern void new_decl_spec(/*
  564. X      DeclSpec *decl_spec,
  565. X      char *text,
  566. X!     int flags
  567. X      */);
  568. X  extern void join_decl_specs(/*
  569. X      DeclSpec *result,
  570. END_OF_patch1
  571. if test 13164 -ne `wc -c <patch1`; then
  572.     echo shar: \"patch1\" unpacked with wrong size!
  573. fi
  574. # end of overwriting check
  575. fi
  576. if test -f cproto.man -a "${1}" != "-c" ; then 
  577.   echo shar: Will not over-write existing file \"cproto.man\"
  578. else
  579. echo shar: Extracting \"cproto.man\" \(4104 characters\)
  580. sed "s/^X//" >cproto.man <<'END_OF_cproto.man'
  581. X
  582. X
  583. XCPROTO(1)                  Unix Programmer's Manual                  CPROTO(1)
  584. X
  585. X
  586. XNAME
  587. X     cproto - generate C function prototypes from C source code
  588. X
  589. XSYNOPSIS
  590. X     cproto [ option ... ] [ file ... ]
  591. X
  592. XDESCRIPTION
  593. X     Cproto reads C source code files  and  outputs  function  prototypes  for
  594. X     external  functions  defined  in  the  source  to  standard  output.  The
  595. X     function definitions may be in the old style or ANSI style.   Optionally,
  596. X     cproto  also  outputs  declarations for any external variables defined in
  597. X     the file.  If no file argument is given, cproto takes its input from  the
  598. X     standard input.
  599. X
  600. XOPTIONS
  601. X
  602. X     -e   Output the keyword extern in front of each declaration having global
  603. X          scope.
  604. X
  605. X     -fn  Set the style of function prototype where n is a number from 0 to 4.
  606. X          For example, consider the function definition
  607. X
  608. X                main (argc, argv)
  609. X                int argc;
  610. X                char *argv[];
  611. X                {
  612. X                 ...
  613. X                }
  614. X
  615. X          If the value is 0, then no prototypes are generated.  When set to 1,
  616. X          the output is:
  617. X
  618. X                int main(/*int argc, char *argv[]*/);
  619. X
  620. X          For a value of 2, the output has the form:
  621. X
  622. X                int main(int /*argc*/, char */*argv*/[]);
  623. X
  624. X          The default value is 3.  It produces the full function prototype:
  625. X
  626. X                int main(int argc, char *argv[]);
  627. X
  628. X          A value of 4 produces prototypes guarded by a macro:
  629. X
  630. X                int main P_((int argc, char *argv[]));
  631. X
  632. X
  633. X     -mname
  634. X          Set the name of the macro used to guard prototypes when  option  -f4
  635. X          is selected.  By default it is "P_".
  636. X
  637. X     -d   Omit the definition of the prototype macro named by the -m option.
  638. X
  639. X     -p   Disable promotion of formal parameters in function  prototypes.   By
  640. X          default,  parameters  of  type  char  or  short in traditional style
  641. X          function definitions are  promoted  to  type  int  in  the  function
  642. X
  643. X
  644. X                              February 28, 1991                              1
  645. X
  646. X
  647. X
  648. X
  649. XCPROTO(1)                  Unix Programmer's Manual                  CPROTO(1)
  650. X
  651. X
  652. X          prototype.  Parameters of type float get promoted to double as well.
  653. X
  654. X     -s   Also output static declarations.
  655. X
  656. X     -v   Also output declarations for variables defined in the file.
  657. X
  658. X     -Fstring
  659. X          Set the format used to output  each  prototype.   The  string  is  a
  660. X          template in the form
  661. X
  662. X                " int main ( a, b )"
  663. X
  664. X          where each space in the  string  may  be  replaced  with  whitespace
  665. X          characters.  For example, the option
  666. X
  667. X                -F"int main(\n\ta,\n\tb\n\t)"
  668. X
  669. X          will produce prototypes in the format
  670. X
  671. X                int main(
  672. X                        int argc,
  673. X                        char *argv[]
  674. X                        );
  675. X
  676. X
  677. X     -Dname\[=value\]
  678. X          This option is passed through to the preprocessor  and  is  used  to
  679. X          define symbols for use with conditionals such as #ifdef.
  680. X
  681. X     -Uname
  682. X          This option is passed through to the preprocessor  and  is  used  to
  683. X          remove any definitions of this symbol.
  684. X
  685. X     -Idirectory
  686. X          This option is passed through to the preprocessor  and  is  used  to
  687. X          specify  a  directory  to  search for files that are referenced with
  688. X          #include.
  689. X
  690. X     -V   Print version information.
  691. X
  692. XBUGS
  693. X     When cproto finds an error, it usually outputs the not  very  descriptive
  694. X     message "syntax error".
  695. X
  696. X     Options that take string arguments only interpret the following
  697. X          character escape sequences:
  698. X
  699. X                \n   newline
  700. X                \t   tab
  701. X
  702. X
  703. XAUTHOR
  704. X     Chin Huang
  705. X     cthuang@contact.uucp
  706. X     chin.huang@canrem.uucp
  707. X
  708. X
  709. X
  710. X                              February 28, 1991                              2
  711. X
  712. X
  713. X
  714. X
  715. XCPROTO(1)                  Unix Programmer's Manual                  CPROTO(1)
  716. X
  717. X
  718. XSEE ALSO
  719. X     cc(1), cpp(1)
  720. X
  721. X
  722. X
  723. X
  724. X
  725. X
  726. X
  727. X
  728. X
  729. X
  730. X
  731. X
  732. X
  733. X
  734. X
  735. X
  736. X
  737. X
  738. X
  739. X
  740. X
  741. X
  742. X
  743. X
  744. X
  745. X
  746. X
  747. X
  748. X
  749. X
  750. X
  751. X
  752. X
  753. X
  754. X
  755. X
  756. X
  757. X
  758. X
  759. X
  760. X
  761. X
  762. X
  763. X
  764. X
  765. X
  766. X
  767. X
  768. X
  769. X
  770. X
  771. X
  772. X
  773. X
  774. X
  775. X
  776. X                              February 28, 1991                              3
  777. X
  778. X
  779. END_OF_cproto.man
  780. if test 4104 -ne `wc -c <cproto.man`; then
  781.     echo shar: \"cproto.man\" unpacked with wrong size!
  782. fi
  783. # end of overwriting check
  784. fi
  785. echo shar: End of shell archive.
  786. exit 0
  787. -- 
  788. Chin Huang  cthuang@contact.uucp  chin.huang@canrem.uucp
  789.  
  790. exit 0 # Just in case...
  791. -- 
  792. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  793. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  794. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  795. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  796.